﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace BOMS.TcpClient
{
   public class Data
    {
      public static string GetSimCodeFromXml(string Ip)
       {
           string Path = System.IO.Directory.GetCurrentDirectory();
           string xmlPath =System.IO.Path.Combine( Path , "SimClientConfig.xml");
           XmlDocument doc = new XmlDocument();
           doc.Load(xmlPath);
           XmlNodeList nodes = doc.SelectNodes("/SimulateClients/Client");
           for (int i = 0; i < nodes.Count; i++)
           {
               if (nodes[i].Attributes["Ip"].Value.ToString() == Ip)
               {
                   return nodes[i].Attributes["EquipID"].Value.ToString();
               }
           }
           return "";
       }
    }
}
